A good answer might be:

If the answer is true something extra is done. If the answer if false nothing is done. (If you are not hungry you don't buy cookies.)

Single-branch If

The "cookie problem" is about whether to do something extra. The choice is about whether to add a visit to the cookie shop to your shopping trip. The following program aids the shopper in this decision. The user of the program rates various factors on a scale of 1 to 10. If the combination of hunger, aroma, and visual appeal of the cookie exceed a threshold of 15, the program recommends a purchase.

import java.io.*;
class CookieDecision
{
  public static void main (String[] args) throws IOException
  {
    String charData;
    double hunger, look, smell ;
    BufferedReader stdin = new BufferedReader ( new InputStreamReader( System.in ) );

    System.out.println("How hungry are you            (1-10):");
    charData = stdin.readLine();
    hunger   = ( Double.valueOf( charData  ) ).doubleValue();

    System.out.println("How nice does the cookie look (1-10):");
    charData = stdin.readLine();
    look     = ( Double.valueOf( charData  ) ).doubleValue();

    System.out.println("How nice does the cookie smell (1-10):");
    charData = stdin.readLine();
    smell    = ( Double.valueOf( charData  ) ).doubleValue();

    if ( (hunger + look + smell ) > 15.0 )
      System.out.println("Buy the cookie!"  );

    System.out.println("Continue down the Mall.");
  }
}

This is just like the decisions of the previous chapter, but now there is only a true branch.

QUESTION 3:

The user runs the program and rates hunger, appearance, and aroma as 4.5, 6.2, and 9.9, respectively. What will the program print?